<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <title>后台管理</title>
    <link rel="stylesheet" th:href="${#request.getContextPath()}+'/static/layui/css/layui.css'" media="all">
    <link rel="stylesheet" th:href="${#request.getContextPath()}+'/static/css/thesame.css'" media="all">
    <link rel="stylesheet" th:href="${#request.getContextPath()}+'/static/css/headCss.css'" media="all">
    <link rel="stylesheet" th:href="${#request.getContextPath()}+'/static/css/leftSidebar.css'" media="all">
    <link rel="stylesheet" th:href="${#request.getContextPath()}+'/static/css/rightCon.css'" media="all">
    <link rel="stylesheet" th:href="${#request.getContextPath()}+'/static/css/popCss.css'" media="all"/>
    <style type="text/css">
        .current {background-color:white;color: #1C9399;}
        .layui-layer-rim{border: none !important;}
        .currentSec {background-color: rgba(28, 147, 153, 0.1);color: #1C9399;}
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<input type="hidden" id="basePathInput" th:value="${#request.getScheme()+'://'+ #request.getServerName() + ':'+#request.getServerPort()+ #request.getContextPath()}">

<div th:replace="view/gcSys/head :: head"></div>
<div th:replace="view/gcSys/left :: left"></div>
<div class="layui-body" style="bottom: 0 !important;">
    <iframe id="mainContainer" name="mainContainer" style="overflow: visible; border: none" width="100%" height="100%" scrolling="no" marginheight="0" marginwidth="0" th:src="${#request.getContextPath()}+'/welcome'"></iframe>
</div>

</div>

<script th:src="${#request.getContextPath()}+'/static/js/jquery-2.1.3.min.js'"></script>
<script th:src="${#request.getContextPath()}+'/static/layui/layui.js'" charset="utf-8"></script>
<script th:src="${#request.getContextPath()}+'/static/js/layuiCon.js'" charset="utf-8"></script>
<script th:inline="javascript">var basePath = [[${#httpServletRequest.getContextPath()}]];</script>
<script>
    //左侧菜单栏
    layui.use(['element','form'],function() {
        var element = layui.element;
        var form = layui.form;
    });

    $(function(){
        //当新用户登陆系统时，提示需要修改密码
        // var pwdFlag ='[[${pwdFlag}]]';
        // if(pwdFlag==0){
        //     layer.alert("请先进入个人中心修改密码后，才能访问全部菜单", function(){
        //         layer.closeAll();
        //     });
        // }

        //登出
        $("a#loginOut").on("click",function (e) {
            window.location.href = basePath+"/gc/outLogin";
        })

        //获取菜单
        var initMenu = '[[${initMenu}]]';
        //getMenu(initMenu);
    })


    /**
     * 获取菜单
     */
    function getMenu(menuNo) {
        //var userNo = '[[${userNo}]]';
        $.ajax({
            url:basePath+"/getMenuByUser",
            type:"post",
            dataType:"json",
            data:{"menuNo":menuNo},
            success:function (result) {
                var userNo = result.msg;
                if(result.code == 200) {
                        // 二级菜单
                    let html = '<div class="layui-left-con layui-left-label-con pad12px">';
                    html += '<div class="new-add-box-scroll" style="overflow-y: scroll">';
                    html += '<nav class="label-nav-con">';
                    var count = 0;
                    $.each(result.data, function (index, lv1) {
                        if (lv1.count >= 0) {
                            html += '<div class="f16px"><img src="' + basePath + '/static/img/icon_label.png">' + lv1.NAME + '</div>';
                            html += '<ul class="lh40px f14px">';
                            $.each(lv1.data, function (index, lv2) {
                                html += '<li data-url="' + lv2.URL + '">' + lv2.NAME + '</li>';
                                count++;
                            })
                        }
                        html += '</ul>';
                    });

                    html += '</nav>';
                    html += '</div>';
                    html += '</div>';
                    $("div#menuArticle").html(html);

                    //二级菜单选中样式
                    $('.label-nav-con li').click(function () {
                        $(this).addClass('currentSec').siblings().removeClass('currentSec');
                    })

                    $("div.layui-left-label-con li").click(function () {
                        var url = $(this).data("url");
                        if (url && "null" != url) {
                            window.frames['mainContainer'].location.href = basePath + url;
                        }
                        //$(this).addClass('currentSec').parent().siblings().children().removeClass('currentSec').css("background",rgba(28, 147, 153, 0.1));
                        $(this).addClass('currentSec').parent().siblings().children().removeClass('currentSec');
                    });


                }

            }
        })
    }

    //跳转链接
    function jumpUrl(obj){ 
        var url = $(obj).data("url");
        window.frames['mainContainer'].location.href = url;
    }

</script>
</body>
</html>
